#ifndef HISTORY_H
#define HISTORY_H

#include <QMainWindow>
#include <QTimer>
#include <QDateTime>
#include "qcustomplot.h"
#include "mqtthandler.h"
#include "globalval.h"
#include <QByteArray>

namespace Ui {
class History;
}
struct data{
    int key;
    int data;
    qint64  timestamp_ms;
};

class History : public QMainWindow
{
    Q_OBJECT

public:
    explicit History(QWidget *parent = 0);
    ~History();
    //设置qcustomplot画图属性，实时
    void setupRealtimeDataDemo(QCustomPlot *customPlot);
private slots:
    //添加实时数据槽
    void realtimeDataSlot( const QByteArray& payload);
    void StartSlot();
    void StopSlot();
private:
    bool isPaused = false;
    Ui::History *ui;
    //定时器，周期调用realtimeDataSlot()槽，实现动态数据添加到曲线
    QTimer dataTimer;
};

#endif // HISTORY_H
